package com.bbva.kyfb.kyfbjpatlsb.dominiotlsb;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.dbre.RooDbManaged;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import org.springframework.transaction.annotation.Transactional;

/**
 * The Class Ttlsbffs.
 */
@Entity
@Table(name = "TTLSBFFS",schema = "TLSB")
@Configurable
@RooJavaBean
@RooToString
@RooEntity(identifierType = TtlsbffsPK.class, versionField = "",  persistenceUnit="persistenceUnitTLSB", table = "TTLSBFFS", schema = "TLSB")
@PersistenceContext(unitName="persistenceUnitTLSB")
@RooDbManaged(automaticallyDelete = true)
public class Ttlsbffs {

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("AudFmodific: ").append(getAudFmodific()).append(", ");
        sb.append("AudUsuario: ").append(getAudUsuario()).append(", ");
        sb.append("CodBancoint: ").append(getCodBancoint()).append(", ");
        sb.append("CodBancopr: ").append(getCodBancopr()).append(", ");
        sb.append("CodCanaldi: ").append(getCodCanaldi()).append(", ");
        sb.append("CodLogon2: ").append(getCodLogon2()).append(", ");
        sb.append("CodNumaleat: ").append(getCodNumaleat()).append(", ");
        sb.append("CodProdserv: ").append(getCodProdserv()).append(", ");
        sb.append("CodSubprodu: ").append(getCodSubprodu()).append(", ");
        sb.append("DesNomfiche: ").append(getDesNomfiche()).append(", ");
        sb.append("Id: ").append(getId()).append(", ");
        sb.append("XsnFirmado: ").append(getXsnFirmado()).append(", ");
        sb.append("XtiPodfir: ").append(getXtiPodfir()).append(", ");
        sb.append("XtiTipoapod: ").append(getXtiTipoapod());
        return sb.toString();
    }

	/** The entity manager. */
	@PersistenceContext(unitName="persistenceUnitTLSB")
    transient EntityManager entityManager;

	/** The id. */
	@EmbeddedId
    private TtlsbffsPK id;

	/**
	 * Gets the id.
	 *
	 * @return the id
	 */
	public TtlsbffsPK getId() {
        return this.id;
    }

	/**
	 * Sets the id.
	 *
	 * @param id the new id
	 */
	public void setId(TtlsbffsPK id) {
        this.id = id;
    }

	/**
	 * Persist.
	 */
	@Transactional(value="tlsb")
    public void persist() {
        if (this.entityManager == null) this.entityManager = entityManager();
        this.entityManager.persist(this);
    }

	/**
	 * Removes the.
	 */
	@Transactional(value="tlsb")
    public void remove() {
        if (this.entityManager == null) this.entityManager = entityManager();
        if (this.entityManager.contains(this)) {
            this.entityManager.remove(this);
        } else {
            Ttlsbffs attached = Ttlsbffs.findTtlsbffs(this.id);
            this.entityManager.remove(attached);
        }
    }

	/**
	 * Flush.
	 */
	@Transactional(value="tlsb")
    public void flush() {
        if (this.entityManager == null) this.entityManager = entityManager();
        this.entityManager.flush();
    }

	/**
	 * Clear.
	 */
	@Transactional(value="tlsb")
    public void clear() {
        if (this.entityManager == null) this.entityManager = entityManager();
        this.entityManager.clear();
    }

	/**
	 * Merge.
	 *
	 * @return the ttlsbffs
	 */
	@Transactional(value="tlsb")
    public Ttlsbffs merge() {
        if (this.entityManager == null) this.entityManager = entityManager();
        Ttlsbffs merged = this.entityManager.merge(this);
        this.entityManager.flush();
        return merged;
    }

	/**
	 * Entity manager.
	 *
	 * @return the entity manager
	 */
	public static final EntityManager entityManager() {
        EntityManager em = new Ttlsbffs().entityManager;
        if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
        return em;
    }

	
	/**
	 * Count ttlsbffses.
	 *
	 * @return the long
	 */
	@Transactional(value="tlsb")
	public static long countTtlsbffses() {
        return entityManager().createQuery("SELECT COUNT(o) FROM Ttlsbffs o", Long.class).getSingleResult();
    }

	
	/**
	 * Find all ttlsbffses.
	 *
	 * @return the list
	 */
	@Transactional(value="tlsb")
	public static List<Ttlsbffs> findAllTtlsbffses() {
        return entityManager().createQuery("SELECT o FROM Ttlsbffs o", Ttlsbffs.class).getResultList();
    }

	
	/**
	 * Find ttlsbffs.
	 *
	 * @param id the id
	 * @return the ttlsbffs
	 */
	@Transactional(value="tlsb")
	public static Ttlsbffs findTtlsbffs(TtlsbffsPK id) {
        if (id == null) return null;
        return entityManager().find(Ttlsbffs.class, id);
    }

	
	/**
	 * Find ttlsbffs entries.
	 *
	 * @param firstResult the first result
	 * @param maxResults the max results
	 * @return the list
	 */
	@Transactional(value="tlsb")
	public static List<Ttlsbffs> findTtlsbffsEntries(int firstResult, int maxResults) {
        return entityManager().createQuery("SELECT o FROM Ttlsbffs o", Ttlsbffs.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
    }

	/** The cod canaldi. */
	@Column(name = "COD_CANALDI",columnDefinition = "SMALLINT")
    @NotNull
    private Short codCanaldi;

	/** The cod bancoint. */
	@Column(name = "COD_BANCOINT",columnDefinition = "SMALLINT")
    @NotNull
    private Short codBancoint;

	/** The cod logon2. */
	@Column(name = "COD_LOGON2",columnDefinition = "CHAR", length = 20)
    @NotNull
    private String codLogon2;

	/** The cod bancopr. */
	@Column(name = "COD_BANCOPR",columnDefinition = "SMALLINT")
    @NotNull
    private Short codBancopr;

	/** The cod prodserv. */
	@Column(name = "COD_PRODSERV",columnDefinition = "SMALLINT")
    @NotNull
    private Short codProdserv;

	/** The cod subprodu. */
	@Column(name = "COD_SUBPRODU",columnDefinition = "SMALLINT")
    @NotNull
    private Short codSubprodu;

	/** The des nomfiche. */
	@Column(name = "DES_NOMFICHE",columnDefinition = "CHAR", length = 40)
    @NotNull
    private String desNomfiche;

	/** The cod numaleat. */
	@Column(name = "COD_NUMALEAT",columnDefinition = "CHAR", length = 9)
    @NotNull
    private String codNumaleat;

	/** The xti tipoapod. */
	@Column(name = "XTI_TIPOAPOD")
    @NotNull
    private Character xtiTipoapod;

	/** The xti podfir. */
	@Column(name = "XTI_PODFIR",columnDefinition = "CHAR", length = 2)
    @NotNull
    private String xtiPodfir;

	/** The xsn firmado. */
	@Column(name = "XSN_FIRMADO",columnDefinition = "CHAR")
    @NotNull
    private Character xsnFirmado;

	/** The aud usuario. */
	@Column(name = "AUD_USUARIO",columnDefinition = "CHAR", length = 8)
    @NotNull
    private String audUsuario;

	/** The aud fmodific. */
	@Column(name = "AUD_FMODIFIC",columnDefinition = "DATE")
    @NotNull
    @Temporal(TemporalType.DATE)
    @DateTimeFormat(style = "M-")
    private Date audFmodific;

	/**
	 * Gets the cod canaldi.
	 *
	 * @return the cod canaldi
	 */
	public Short getCodCanaldi() {
        return this.codCanaldi;
    }

	/**
	 * Sets the cod canaldi.
	 *
	 * @param codCanaldi the new cod canaldi
	 */
	public void setCodCanaldi(Short codCanaldi) {
        this.codCanaldi = codCanaldi;
    }

	/**
	 * Gets the cod bancoint.
	 *
	 * @return the cod bancoint
	 */
	public Short getCodBancoint() {
        return this.codBancoint;
    }

	/**
	 * Sets the cod bancoint.
	 *
	 * @param codBancoint the new cod bancoint
	 */
	public void setCodBancoint(Short codBancoint) {
        this.codBancoint = codBancoint;
    }

	/**
	 * Gets the cod logon2.
	 *
	 * @return the cod logon2
	 */
	public String getCodLogon2() {
        return this.codLogon2;
    }

	/**
	 * Sets the cod logon2.
	 *
	 * @param codLogon2 the new cod logon2
	 */
	public void setCodLogon2(String codLogon2) {
        this.codLogon2 = codLogon2;
    }

	/**
	 * Gets the cod bancopr.
	 *
	 * @return the cod bancopr
	 */
	public Short getCodBancopr() {
        return this.codBancopr;
    }

	/**
	 * Sets the cod bancopr.
	 *
	 * @param codBancopr the new cod bancopr
	 */
	public void setCodBancopr(Short codBancopr) {
        this.codBancopr = codBancopr;
    }

	/**
	 * Gets the cod prodserv.
	 *
	 * @return the cod prodserv
	 */
	public Short getCodProdserv() {
        return this.codProdserv;
    }

	/**
	 * Sets the cod prodserv.
	 *
	 * @param codProdserv the new cod prodserv
	 */
	public void setCodProdserv(Short codProdserv) {
        this.codProdserv = codProdserv;
    }

	/**
	 * Gets the cod subprodu.
	 *
	 * @return the cod subprodu
	 */
	public Short getCodSubprodu() {
        return this.codSubprodu;
    }

	/**
	 * Sets the cod subprodu.
	 *
	 * @param codSubprodu the new cod subprodu
	 */
	public void setCodSubprodu(Short codSubprodu) {
        this.codSubprodu = codSubprodu;
    }

	/**
	 * Gets the des nomfiche.
	 *
	 * @return the des nomfiche
	 */
	public String getDesNomfiche() {
        return this.desNomfiche;
    }

	/**
	 * Sets the des nomfiche.
	 *
	 * @param desNomfiche the new des nomfiche
	 */
	public void setDesNomfiche(String desNomfiche) {
        this.desNomfiche = desNomfiche;
    }

	/**
	 * Gets the cod numaleat.
	 *
	 * @return the cod numaleat
	 */
	public String getCodNumaleat() {
        return this.codNumaleat;
    }

	/**
	 * Sets the cod numaleat.
	 *
	 * @param codNumaleat the new cod numaleat
	 */
	public void setCodNumaleat(String codNumaleat) {
        this.codNumaleat = codNumaleat;
    }

	/**
	 * Gets the xti tipoapod.
	 *
	 * @return the xti tipoapod
	 */
	public Character getXtiTipoapod() {
        return this.xtiTipoapod;
    }

	/**
	 * Sets the xti tipoapod.
	 *
	 * @param xtiTipoapod the new xti tipoapod
	 */
	public void setXtiTipoapod(Character xtiTipoapod) {
        this.xtiTipoapod = xtiTipoapod;
    }

	/**
	 * Gets the xti podfir.
	 *
	 * @return the xti podfir
	 */
	public String getXtiPodfir() {
        return this.xtiPodfir;
    }

	/**
	 * Sets the xti podfir.
	 *
	 * @param xtiPodfir the new xti podfir
	 */
	public void setXtiPodfir(String xtiPodfir) {
        this.xtiPodfir = xtiPodfir;
    }

	/**
	 * Gets the xsn firmado.
	 *
	 * @return the xsn firmado
	 */
	public Character getXsnFirmado() {
        return this.xsnFirmado;
    }

	/**
	 * Sets the xsn firmado.
	 *
	 * @param xsnFirmado the new xsn firmado
	 */
	public void setXsnFirmado(Character xsnFirmado) {
        this.xsnFirmado = xsnFirmado;
    }

	/**
	 * Gets the aud usuario.
	 *
	 * @return the aud usuario
	 */
	public String getAudUsuario() {
        return this.audUsuario;
    }

	/**
	 * Sets the aud usuario.
	 *
	 * @param audUsuario the new aud usuario
	 */
	public void setAudUsuario(String audUsuario) {
        this.audUsuario = audUsuario;
    }

	/**
	 * Gets the aud fmodific.
	 *
	 * @return the aud fmodific
	 */
	public Date getAudFmodific() {
        return this.audFmodific;
    }

	/**
	 * Sets the aud fmodific.
	 *
	 * @param audFmodific the new aud fmodific
	 */
	public void setAudFmodific(Date audFmodific) {
        this.audFmodific = audFmodific;
    }
}
